package com.ys.controller.web.mall;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import com.bo.vo.W;
import com.ys.controller.api.mall.ApiInterTmGiftGivenController;
import com.ys.entity.mall.TmGiftGiven;
import com.ys.service.sys.CommonApiService;

@Controller
@RequestMapping("/web/mall/tmGiftGiven")
public class WebTmGiftGivenController {
	
	public static Long MENU_ID = ApiInterTmGiftGivenController.MENU_ID;
	
	@Autowired
	private CommonApiService<TmGiftGiven> commonApiService;
	
	/*
	 * 审核
	 */
	@RequiresPermissions("tmGiftGiven:flow")
	@GetMapping("/toFlow")
	public String toFlow(Model model, HttpServletRequest request, HttpServletResponse response,
			String bid){
		if (bid == null || bid.length() == 0) {
			return W.error(model, "单号不能为空");
		}
		
		TmGiftGiven entity = new TmGiftGiven().setBid(bid).queryFirst();
		
		try {
			return commonApiService.toEdit(model, entity.getId(), new TmGiftGiven(), MENU_ID, null, null);
		} catch (Exception e) {
			e.printStackTrace();
			return W.error(model, "");
		}
	}
}
